package com.itheima.day08.myTreeSet.test6;

public class Test1 {
    public static void main(String[] args) {

    }
    public int compare(ReportCard t1, ReportCard t2) {
        double sum1 = t1.getLanguage() + t1.getMathematics() + t1.getEnglish();
        double sum2 = t2.getLanguage() + t2.getMathematics() + t2.getEnglish();
        double difference = sum1 - sum2;
        difference = difference == 0 ? t1.getLanguage() - t2.getLanguage() : difference;
        difference = difference == 0 ? t1.getMathematics() - t1.getMathematics() : difference;
        difference = difference == 0 ? t1.getEnglish() - t2.getEnglish() : difference;
        difference = difference == 0 ? t1.getName().compareTo(t2.getName()) : difference;
        return (int) difference;
    }
}
